#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Scanner.h"

int ExecuteScanner(char* inputFileName)
{
    //char inputFile[10] = "input.txt";
    //char outputFile[11] = "output.txt";

    inputStreamScanner = fopen(inputFileName, "r");

	if(inputStreamScanner == NULL)
	{
		fprintf(stderr, "Can't open input file %s!\n", inputFileName);
		return 1;
	}

    InitializeScanner();

    ReadFile();
    OutputCode(stdout);

	fprintf(stdout, "\n\n");

    OutputLexemeTable(stdout);

    fprintf(stdout, "\n\n");

    OutputLexemeList(stdout);

    fclose(inputStreamScanner);

    return 0;
}

int main(int argc, char* argv[])
{
	if(argc < 2)
	{
		printf("Usage: %s INPUT\n", argv[0]);
		return 1;
	}
	return ExecuteScanner(argv[1]);
}

